home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir37 / mxmnu241.zip / WINSUP.INC < prev    next >
Text File  |  1992-11-17  |  3KB  |  144 lines

  1. Comment
  2. ==========================================================
  3.  
  4. Menu support routines.
  5.  
  6. ==========================================================
  7. EndComment
  8.  
  9.  
  10. ;----- Support routines for conditional menus
  11.  
  12. Var
  13.   VertLine = "┬││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││"
  14.   VertLine2 = "││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││"
  15.   VertLine3 = "┌─┴┴┴┴─┐"
  16.   VertLine4 = "└─┬┬┬┬─┘"
  17.   IndexString
  18.   MyGroups
  19.  
  20.  
  21. ;----- Init Code
  22.  
  23. OnScreenOnly ;limits choices to those on the screen only.
  24. AllowEsc
  25. AllowAbort Off
  26. UseArrows Off
  27. LookSetup
  28.  
  29. ;----- Code for Group Conditionals
  30.  
  31. if NetworkVersion
  32.    if NovConnection > 0
  33.       NovReadGroups(NovLoginName,MyGroups)    ;Read Groups user is in.
  34.       SortArray(MyGroups)
  35.    endif
  36. endif
  37.  
  38. ;----- Adds a choice to list
  39.  
  40. Procedure AddChoice (Prompt,TaskNum)
  41.    if TaskNum <> 0
  42.       IndexString[CurrentWindow + 1] = Left(IndexString[CurrentWindow + 1],NumberOfElements(Choices)) + Char(TaskNum + 64)
  43.    endif
  44.    AppendArray(Choices,Prompt)
  45. EndProc
  46.  
  47. ;----- Compares TaskNum to Choice
  48.  
  49. Procedure Task (TaskNum)
  50.    if Mid(IndexString[CurrentWindow],Ord(LastKey) - 64,1) = Char(TaskNum + 64)
  51.       Return LastKey
  52.    else
  53.       Return ""
  54.    endif
  55. EndProc
  56.  
  57. ;----- Returns True if in list
  58.  
  59. Procedure InGroup (Group)
  60.    Return PosInSortedList(UpperCase(Group),MyGroups) > 0
  61. EndProc
  62.  
  63. ;----- Windowing Support
  64.  
  65. Procedure CenterStretchBox (Header,Col,Row)
  66.    MakeBox(Header,Col,Row,True)
  67. EndProc
  68.  
  69.  
  70. Procedure CornerStretchBox (Header,Col,Row)
  71.    if Row = 0 then Row = 5
  72.    if Col = 0 then Col = 8 + (CurrentWindow - 3 * 4)
  73.    MakeBox(Header,Col,Row,False)
  74. EndProc
  75.  
  76.  
  77. ;------ MenuExit Procedure
  78.  
  79. Procedure LeaveMenu
  80.    DrawTheBox (ScreenWidth / 2 - 4,ScreenHeight / 2 - 1,13,HeightDifference + 2,'Exit Menu')
  81.    Writeln " Yes"
  82.    Write   " No"
  83.  
  84.    OnKey "Y"
  85.       |ExitMenu
  86.  
  87.    OnKey "N"
  88.       |LastKey = Esc
  89.  
  90. EndProc
  91.  
  92. ;------ Read a Text Line Procedure
  93.  
  94. Procedure ReadTextLine(St,Header,Col,Row)
  95. var AnswerLine
  96.    Choices[1] = ""
  97.    CenterStretchBox(Header,Col,Row)
  98.    Write " " St " "
  99.    TextColor(MenuCapColorFG,MenuBG)
  100.    AnswerLine = Readln
  101.    EraseTopWindow
  102.    Dispose Choices
  103.    Return AnswerLine
  104. EndProc
  105.  
  106. ;----- View a File
  107.  
  108. Procedure ViewFile (Name)
  109.    if Name = '' then Return
  110.    BoxHeader = ' Viewing ' + Name + ' '
  111.    Shadow Off
  112.    DrawBox 1 4 80 21
  113.    TextColor MenuHeaderFG MenuBG
  114.    ViewTextFile Name
  115. EndProc
  116.  
  117. Procedure GreekColumns
  118.    TextColor GreekFG GreekBG
  119.    GotoXY 4,4
  120.    WriteVertical VertLine2
  121.    GotoXY 5,4
  122.    WriteVertical VertLine2
  123.    GotoXY 6,4
  124.    WriteVertical VertLine2
  125.    GotoXY 7,4
  126.    WriteVertical VertLine2
  127.    GotoXY ScreenWidth - 6,4
  128.    WriteVertical VertLine2
  129.    GotoXY ScreenWidth - 5,4
  130.    WriteVertical VertLine2
  131.    GotoXY ScreenWidth - 4,4
  132.    WriteVertical VertLine2
  133.    GotoXY ScreenWidth - 3,4
  134.    WriteVertical VertLine2
  135.    GotoXY 2,4
  136.    Write VertLine4
  137.    GotoXY ScreenWidth - 8,4
  138.    Write VertLine4
  139.    GotoXY 2,ScreenHeight - 1
  140.    Write VertLine3
  141.    GotoXY ScreenWidth - 8,ScreenHeight - 1
  142.    Write VertLine3
  143. EndProc
  144.